<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <component-a></component-a>

    </div>

    <div id="app1">
        <component-a></component-a>

    </div>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.9/vue.js"></script>
    <script>
        var ComponentB = {
            template: `<div>{{msg}}<a>11</a></div>`,// 组件的模板中 只能有一个根元素 root
            data() {
                return {
                    msg: "组件B"
                }
            }
        }
        var ComponentA = {
            name: "ComponentAaaaaaaaa", // 方便开发工具来显示组件名称，把名称和组件的注册名一致
            template: `<div>{{msg}}<component-b></component-b></div>`,
            data() {
                return {
                    msg: "组件A",
                }
            },
            components: {
                ComponentB
            }
        }

        var vm = new Vue({
            // name: "ComponentAAAAlllllAAA",
            el: "#app",
            data: {

            },
            components: {
                // key组件的标签名， value组件的配置对象
                ComponentA
                // 前面这个就可以随便写名字，但是要打引号，如果不打引号就要跟后面的名字一样就可以不打
                // "ComponentA": ComponentA
                // ComponentA: ComponentA
                // 'component-a': ComponentA
            }
        })


        var vm = new Vue({
            el: "#app1",
            data: {

            },
            components: {}
        })
    </script>
</body>

</html>